﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using CivilisationLib;

namespace IHM
{
    /// <summary>
    /// Logique d'interaction pour MenuPrincipal.xaml
    /// </summary>
    public partial class MenuPrincipal : Window
    {
        public MenuPrincipal()
        {
            InitializeComponent();            
        }

        private void NouvellePartie(object sender, RoutedEventArgs e)
        {
            NouvellePartie partie = new NouvellePartie();
            App.Current.MainWindow = partie;
            this.Close();
            partie.Show();
        }

        private void Quitter(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void ChargerPartie(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog boiteOuverture = new System.Windows.Forms.OpenFileDialog();
            boiteOuverture.Filter = "Fichier bin(*.bin)|*.bin";
            if (boiteOuverture.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {

                Partie partie = Partie.Charger(boiteOuverture.FileName);
                CarteIHM carte = new CarteIHM(partie);
                App.Current.MainWindow = carte;
                this.Close();
                carte.Show();
            }
        }
    }
}
